import Message from './message'

export default {
  install (Vue, options) {
    const MessageClass = Vue.extend(Message)

    Vue.prototype.$message = {
      success: () => {},
      info: () => {},
      error: (str) => {
        const messageComponent = new MessageClass({
          propsData: {
            msg: str,
            type: 'error'
          }
        })
        messageComponent.$mount()

        document.body.appendChild(messageComponent.$el)
        console.log(messageComponent.$el)
        // alert(str)
      }
    }
  }
}
